<?php
/**
 * @version		$Id: blog_item.php 21651 2011-06-23 05:31:49Z chdemko $
 * @package		Joomla.Site
 * @subpackage	com_content
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

// Create a shortcut for params.
$params = &$this->item->params;
$canEdit	= $this->item->params->get('access-edit');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::core();

?>
                         	
                               
                                <!-- News Listing -->
                                <ul class="listing">
<?php if ($this->item->state == 0) : ?>

<?php endif; ?>






<?php if (!$params->get('show_intro')) : ?>
	<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>

<?php echo $this->item->event->beforeDisplayContent; ?>

<?php // to do not that elegant would be nice to group the params ?>

<?php if (($params->get('show_author')) or ($params->get('show_category')) or ($params->get('show_create_date')) or ($params->get('show_modify_date')) or ($params->get('show_publish_date')) or ($params->get('show_parent_category')) or ($params->get('show_hits'))) : ?>

<?php endif; ?>
<li>
															<div class="thumb1">
															<?php		
															$arr2 = preg_split('/<(IMG|img) /', $this->item->introtext.$this->item->fulltext);
															$arr3 = preg_split('/src=\"/', $arr2[1]);
															$arr4 = preg_split('/\"/', $arr3[1]);
															if(preg_match('/http:/', $arr4[0]))
															{
																$result = $arr4[0];
															}
															else if(preg_match('/^\//', $arr4[0])){
																$result = $u2 . substr($arr4[0],1);
															}
															else
															{
																for($ei = 3; $ei < sizeof($u1) - 1; $ei++)
																{
															
															$u2 .= $u1[$ei] . "/";
																}
																$result = $u2 . $arr4[0];
															}
														  ?>
														  <img src="<?php if ($result=="") 
																					echo JURI::base()."/templates/tpmsolutions/images/noimg2.jpg";
																					else echo $result; ?>" alt="" class="slider_img" title=""  class="imagecache imagecache-938x240" />
														</div>
									<div class="description">
                                        	<h6>
	
											<?php if ($params->get('show_title')) : ?>

											<?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
												<a class="colr" href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
												<?php echo $this->escape($this->item->title); ?></a>
											<?php else : ?>
												<?php echo $this->escape($this->item->title); ?>
											<?php endif; ?>

											<?php endif; ?>
											
											</h6>
                                            
                                               
											   <?php						
															$words = explode(" ", strip_tags($this->item->introtext.$this->item->fulltext));
															if(count($words) > 45)
															{
																for($i=0;$i<=45;$i++)
																{
																	echo $words[$i]." ";
																}
																echo "...";
															}
															else
															{
																echo strip_tags($this->item->introtext.$this->item->fulltext);
															}
															?>
                                            <div class="clear"></div>
                                            <div class="info">
                                            	<span class="lastupdte"><?php  echo JText::_('COM_CONTENT_DATE'); ?><i>		
												<?php if ($params->get('show_publish_date')) : ?>

												<?php echo  JHtml::_('date',$this->item->publish_up, JText::_('DATE_FORMAT_LC2')); ?>

												<?php endif; ?>
												</i></span> 
                                                <span class="tag"><?php  echo JText::_('COM_CONTENT_CATE'); ?>
												
												<?php if ($params->get('show_category')) : ?>
														
															<?php $title = $this->escape($this->item->category_title);
																	$url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid)) . '">' . $title . '</a>'; ?>
															<?php if ($params->get('link_category')) : ?>
																<?php echo $url; ?>
																<?php else : ?>
																<?php echo $title; ?>
															<?php endif; ?>
														
												<?php endif; ?>
												
												</span> 
                                            	
                                                 
                                            </div>
                 </div>


												<?php if ($params->get('show_parent_category') && $this->item->parent_id != 1) : ?>
		
			<?php $title = $this->escape($this->item->parent_title);
				$url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->parent_id)) . '">' . $title . '</a>'; ?>
			<?php if ($params->get('link_parent_category')) : ?>
				<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
				<?php else : ?>
				<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
			<?php endif; ?>
		
<?php endif; ?>

<?php if ($params->get('show_readmore') && $this->item->readmore) :
	if ($params->get('access-view')) :
		$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
	else :
		$menu = JFactory::getApplication()->getMenu();
		$active = $menu->getActive();
		$itemId = $active->id;
		$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
		$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
		$link = new JURI($link1);
		$link->setVar('return', base64_encode($returnURL));
	endif;
?>

<?php endif; ?>

<?php if ($this->item->state == 0) : ?>

<?php endif; ?>

<div class="clear"></div>

</li>
                                </ul>
  
<?php echo $this->item->event->afterDisplayContent; ?>
                                